<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../vue@3.2.23.js"></script>
	</head>
	<body>
		<div id="app">
			<div class="count">父组件的计数器:{{count}}</div>
			<!-- 传值 属性传值 -->
			<counter :count="count" msg="提示:你确定要删除此项吗"></counter>
		</div>
	</body>
</html>
<script>
	//局部组件
	const counter = {
		//接收
		// props:['count','msg'],
		props:{
			count:{
				//类型数据检查
				type:Number,
				//自定义数据校验
				Validator:function(val){
					return val < 100
				},
				//参数的默认值
				default:60
			},
			msg:{
				type:String,
				//必传
				required:true
			}
		},
		template:
		`
		<div>子组件的计数器:{{count}}</div>
		<div>{{msg}}</div>
		`
	}
	const app = Vue.createApp({
		components:{
			counter
		},
		data() {
			return{
				count:20
			}
		}
	})
	const vm = app.mount("#app")
</script>